from smartpi import ultrasonic
distance = ultrasonic.get_value(b'P1')  # cm 
